AttrDXL to show baselined version of Object Text

Hi all,

I was wondering whether this was possible and if so I'd welcome any pointers!

The basic idea is to have "Proposed Change" type functionality within a bunch of modules, so users can go in and make changes directly to the Object Text/Heading (in effect the 'proposed change', but it will feature a column that dynamically shows (i.e. don't have to run a tool to populate an attribute first) the Object Text (and ideally object heading also) from the latest baseline.

I did look at the histcol.dxl for some ideas, but this seems to let the user select a baseline then parse that baseline with a for o in m loop saving away the data, this doesn't seem very efficient. Is there not some kind of getRichAttr(Module m, Baseline b, Object o, Attribute a) type function that can get it on the fly?

Any help very much appreciated!

Rob
Rob6 - Fri Jan 07 10:34:42 EST 2011

Re: AttrDXL to show baselined version of Object Text
Mathias Mamsch - Fri Jan 07 15:46:10 EST 2011

Nope there is no such function unfortunately. But there is a pretty straightforward way to achieve this (open baseline, find object, display its contents). I would suggest a DXL attribute for this. I guess a good start would be something like this:
 

<code class="jive-code jive-java">
Module m = current Object oCur = obj   <span style="color: navy">
<b>
if</b></span> (<s<code class="jive-code jive-java">
Module m = current Object oCur = obj   <span style="color: navy">
<b>
if</b></span> (<span style="color: navy">
<b>
null</b></span> getMostRecentBaseline m) halt <span style="color: darkgreen">
// no baseline here ...</span> ModuleVersion mv = moduleVersion (module m, getMostRecentBaseline m) Module bsMod = data mv <span style="color: navy">
<b>
if</b></span> (<span style="color: navy">
<b>
null</b></span> bsMod) bsMod = load(mv, <span style="color: navy">
<b>
false</b></span>)   <span style="color: navy">
<b>
if</b></span> (<span style="color: navy">
<b>
null</b></span> bsMod) halt   <span style="color: navy">
<b>
int</b></span> iCurNr = oCur.<span style="color: red">
"Absolute Number"</span> Object oBS = object(iCurNr, bsMod)   <span style="color: darkgreen">
// make sure that we also find invisible objects, in case a stupid</span>  <span style="color: darkgreen">
// default view filters away stuff, you never know ...</span>  <span style="color: darkgreen">
// ok. I don't trust the object(...) function, so you probably</span>  <span style="color: darkgreen">
// don't need this. This slows stuff down.</span>  <span style="color: darkgreen">
// ---------------------</span> <span style="color: navy">
<b>
if</b></span> (<span style="color: navy">
<b>
null</b></span> oBS) <span style="color: navy">
{</span> Object oSearch; <span style="color: navy">
<b>
for</b></span> oSearch in entire bsMod <span style="color: navy">
<b>Module m = current 
Object oCur = obj
 
if (null getMostRecentBaseline m) halt // no baseline here ...
ModuleVersion mv = moduleVersion (module m, getMostRecentBaseline m)
Module bsMod = data mv
if (null bsMod) bsMod = load(mv, false) 
 
if (null bsMod) halt
 
int iCurNr = oCur."Absolute Number"
Object oBS = object(iCurNr, bsMod) 
 
// make sure that we also find invisible objects, in case a stupid 
// default view filters away stuff, you never know ... 
// ok. I don't trust the object(...) function, so you probably 
// don't need this. This slows stuff down. 
// ---------------------
if (null oBS) {
    Object oSearch; 
        for oSearch in entire bsMod do { 
                int iSearchNr = oSearch."Absolute Number"; 
                if (iSearchNr == iCurNr) { oBS = oSearch; break }
        }
}
// --------------------
 
if (null oBS) halt // we did not find anything
 
// Use this for DXL Layout 
// displayRichWithColor richTextWithOle(oBS."Object Text") 
 
// Use this for a DXL attribute 
oCur.attrDXLName = richText richTextWithOle(oBS."Object Text")
do</b></span> <span style="color: navy">
{</span> <span style="color: navy">
<b>
int</b></span> iSearchNr = oSearch.<span style="color: red">
"Absolute Number"</span>; <span style="color: navy">
<b>
if</b></span> (iSearchNr == iCurNr) <span style="color: navy">
{</span> oBS = oSearch; <span style="color: navy">
<b>
break</b></span> <span style="color: navy">
}</span> <span style="color: navy">
}</span> <span style="color: navy">
}</span> <span style="color: darkgreen">
// --------------------</span>   <span style="color: navy">
<b>
if</b></span> (<span style="color: navy">
<b>
null</b></span> oBS) halt <span style="color: darkgreen">
// we did not find anything</span>   <span style="color: darkgreen">
// Use this for DXL Layout</span>  <span style="color: darkgreen">
// displayRichWithColor richTextWithOle(oBS."Object Text")</span>    <span style="color: darkgreen">
// Use this for a DXL attribute</span>  oCur.attrDXLName = richText richTextWithOle(oBS.<span style="color: red">
"Object Text"</span>)</code>
pan style="color: navy">
<b>
null</b></span> getMostRecentBaseline m) halt <span style="color: darkgreen">
// no baseline here ...</span> ModuleVersion mv = moduleVersion (module m, getMostRecentBaseline m) Module bsMod = data mv <span style="color: navy">
<b>
if</b></span> (<span style="color: navy">
<b>
null</b></span> bsMod) bsMod = load(mv, <span style="color: navy">
<b>
false</b></span>)   <span style="color: navy">
<b>
if</b></span> (<span style="color: navy">
<b>
null</b></span> bsMod) halt   <span style="color: navy">
<b>
int</b></span> iCurNr = oCur.<span style="color: red">
"Absolute Number"</span> Object oBS = object(iCurNr, bsMod)   <span style="color: darkgreen">
// make sure that we also find invisible objects, in case a stupid</span>  <span style="color: darkgreen">
// default view filters away stuff, you never know ...</span>  <span style="color: darkgreen">
// ok. I don't trust the object(...) function, so you probably</span>  <span style="color: darkgreen">
// don't need this. This slows stuff down.</span>  <span style="color: darkgreen">
// ---------------------</span> <span style="color: navy">
<b>
if</b></span> (<span style="color: navy">
<b>
null</b></span> oBS) <span style="color: navy">
{</span> Object oSearch; <span style="color: navy">
<b>
for</b></span> oSearch in entire bsMod <span style="color: navy">
<b>
do</b></span> <span style="color: navy">
{</span> <span style="color: navy">
<b>
int</b></span> iSearchNr = oSearch.<span style="color: red">
"Absolute Number"</span>; <span style="color: navy">
<b>
if</b></span> (iSearchNr == iCurNr) <span style="color: navy">
{</span> oBS = oSearch; <span style="color: navy">
<b>
break</b></span> <span style="color: navy">
}</span> <span style="color: navy">
}</span> <span style="color: navy">
}</span> <span style="color: darkgreen">
// --------------------</span>   <span style="color: navy">
<b>
if</b></span> (<span style="color: navy">
<b>
null</b></span> oBS) halt <span style="color: darkgreen">
// we did not find anything</span>   <span style="color: darkgreen">
// Use this for DXL Layout</span>  <span style="color: darkgreen">
// displayRichWithColor richTextWithOle(oBS."Object Text")</span>    <span style="color: darkgreen">
// Use this for a DXL attribute</span>  oCur.attrDXLName = richText richTextWithOle(oBS.<span style="color: red">
"Object Text"</span>)</code>

 


Hope this helps, regards, Mathias

 

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

 

Re: AttrDXL to show baselined version of Object Text
Rob6 - Mon Jan 10 04:18:00 EST 2011

Mathias Mamsch - Fri Jan 07 15:46:10 EST 2011

Nope there is no such function unfortunately. But there is a pretty straightforward way to achieve this (open baseline, find object, display its contents). I would suggest a DXL attribute for this. I guess a good start would be something like this:
 

<code class="jive-code jive-java">
Module m = current Object oCur = obj   <span style="color: navy">
<b>
if</b></span> (<s<code class="jive-code jive-java">
Module m = current Object oCur = obj   <span style="color: navy">
<b>
if</b></span> (<span style="color: navy">
<b>
null</b></span> getMostRecentBaseline m) halt <span style="color: darkgreen">
// no baseline here ...</span> ModuleVersion mv = moduleVersion (module m, getMostRecentBaseline m) Module bsMod = data mv <span style="color: navy">
<b>
if</b></span> (<span style="color: navy">
<b>
null</b></span> bsMod) bsMod = load(mv, <span style="color: navy">
<b>
false</b></span>)   <span style="color: navy">
<b>
if</b></span> (<span style="color: navy">
<b>
null</b></span> bsMod) halt   <span style="color: navy">
<b>
int</b></span> iCurNr = oCur.<span style="color: red">
"Absolute Number"</span> Object oBS = object(iCurNr, bsMod)   <span style="color: darkgreen">
// make sure that we also find invisible objects, in case a stupid</span>  <span style="color: darkgreen">
// default view filters away stuff, you never know ...</span>  <span style="color: darkgreen">
// ok. I don't trust the object(...) function, so you probably</span>  <span style="color: darkgreen">
// don't need this. This slows stuff down.</span>  <span style="color: darkgreen">
// ---------------------</span> <span style="color: navy">
<b>
if</b></span> (<span style="color: navy">
<b>
null</b></span> oBS) <span style="color: navy">
{</span> Object oSearch; <span style="color: navy">
<b>
for</b></span> oSearch in entire bsMod <span style="color: navy">
<b>Module m = current 
Object oCur = obj
 
if (null getMostRecentBaseline m) halt // no baseline here ...
ModuleVersion mv = moduleVersion (module m, getMostRecentBaseline m)
Module bsMod = data mv
if (null bsMod) bsMod = load(mv, false) 
 
if (null bsMod) halt
 
int iCurNr = oCur."Absolute Number"
Object oBS = object(iCurNr, bsMod) 
 
// make sure that we also find invisible objects, in case a stupid 
// default view filters away stuff, you never know ... 
// ok. I don't trust the object(...) function, so you probably 
// don't need this. This slows stuff down. 
// ---------------------
if (null oBS) {
    Object oSearch; 
        for oSearch in entire bsMod do { 
                int iSearchNr = oSearch."Absolute Number"; 
                if (iSearchNr == iCurNr) { oBS = oSearch; break }
        }
}
// --------------------
 
if (null oBS) halt // we did not find anything
 
// Use this for DXL Layout 
// displayRichWithColor richTextWithOle(oBS."Object Text") 
 
// Use this for a DXL attribute 
oCur.attrDXLName = richText richTextWithOle(oBS."Object Text")
do</b></span> <span style="color: navy">
{</span> <span style="color: navy">
<b>
int</b></span> iSearchNr = oSearch.<span style="color: red">
"Absolute Number"</span>; <span style="color: navy">
<b>
if</b></span> (iSearchNr == iCurNr) <span style="color: navy">
{</span> oBS = oSearch; <span style="color: navy">
<b>
break</b></span> <span style="color: navy">
}</span> <span style="color: navy">
}</span> <span style="color: navy">
}</span> <span style="color: darkgreen">
// --------------------</span>   <span style="color: navy">
<b>
if</b></span> (<span style="color: navy">
<b>
null</b></span> oBS) halt <span style="color: darkgreen">
// we did not find anything</span>   <span style="color: darkgreen">
// Use this for DXL Layout</span>  <span style="color: darkgreen">
// displayRichWithColor richTextWithOle(oBS."Object Text")</span>    <span style="color: darkgreen">
// Use this for a DXL attribute</span>  oCur.attrDXLName = richText richTextWithOle(oBS.<span style="color: red">
"Object Text"</span>)</code>
pan style="color: navy">
<b>
null</b></span> getMostRecentBaseline m) halt <span style="color: darkgreen">
// no baseline here ...</span> ModuleVersion mv = moduleVersion (module m, getMostRecentBaseline m) Module bsMod = data mv <span style="color: navy">
<b>
if</b></span> (<span style="color: navy">
<b>
null</b></span> bsMod) bsMod = load(mv, <span style="color: navy">
<b>
false</b></span>)   <span style="color: navy">
<b>
if</b></span> (<span style="color: navy">
<b>
null</b></span> bsMod) halt   <span style="color: navy">
<b>
int</b></span> iCurNr = oCur.<span style="color: red">
"Absolute Number"</span> Object oBS = object(iCurNr, bsMod)   <span style="color: darkgreen">
// make sure that we also find invisible objects, in case a stupid</span>  <span style="color: darkgreen">
// default view filters away stuff, you never know ...</span>  <span style="color: darkgreen">
// ok. I don't trust the object(...) function, so you probably</span>  <span style="color: darkgreen">
// don't need this. This slows stuff down.</span>  <span style="color: darkgreen">
// ---------------------</span> <span style="color: navy">
<b>
if</b></span> (<span style="color: navy">
<b>
null</b></span> oBS) <span style="color: navy">
{</span> Object oSearch; <span style="color: navy">
<b>
for</b></span> oSearch in entire bsMod <span style="color: navy">
<b>
do</b></span> <span style="color: navy">
{</span> <span style="color: navy">
<b>
int</b></span> iSearchNr = oSearch.<span style="color: red">
"Absolute Number"</span>; <span style="color: navy">
<b>
if</b></span> (iSearchNr == iCurNr) <span style="color: navy">
{</span> oBS = oSearch; <span style="color: navy">
<b>
break</b></span> <span style="color: navy">
}</span> <span style="color: navy">
}</span> <span style="color: navy">
}</span> <span style="color: darkgreen">
// --------------------</span>   <span style="color: navy">
<b>
if</b></span> (<span style="color: navy">
<b>
null</b></span> oBS) halt <span style="color: darkgreen">
// we did not find anything</span>   <span style="color: darkgreen">
// Use this for DXL Layout</span>  <span style="color: darkgreen">
// displayRichWithColor richTextWithOle(oBS."Object Text")</span>    <span style="color: darkgreen">
// Use this for a DXL attribute</span>  oCur.attrDXLName = richText richTextWithOle(oBS.<span style="color: red">
"Object Text"</span>)</code>

 


Hope this helps, regards, Mathias

 

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

 

Hi Mathias,

Excellent that works perfectly! :) Just what I was after, this makes the Change Management on our requirements modules a whole lot slicker now, as we don't need a "Proposed Text" attribute, users can just make changes directly to the Object Text and see what the baseline was.

Thanks once again, much appreciated! :)

Rob

Re: AttrDXL to show baselined version of Object Text
llandale - Mon Jan 10 13:23:32 EST 2011

Consider adding to your baseline procedure the notion of saving the raw text into an attribute, perhaps called "BaselineText_5.2a" before baselining for version 5.2(a). You would then have some attr-DXL that compares the current text with that of that attribute, and show red-lines and strikeouts. Its pretty straight forward all in all.

  • Louie